﻿Imports MConfig

Module Module1
    Sub Main()
        AddHandler MConfigReader.Instance.OnReadEnvironment, AddressOf OnEnvironmentRead

        Console.WriteLine(String.Format("Environment :{0}", MConfigReader.Instance.ReadEnvironmentName))

        Console.WriteLine()

        Dim ftp = FTPConfig.Instance
        Console.WriteLine(String.Format("FTP Server  :{0}", ftp.Server))
        Console.WriteLine(String.Format("FTP User    :{0}", ftp.User))
        Console.WriteLine(String.Format("FTP Password:{0}", ftp.Password))

        Console.WriteLine()

        Dim db = DBConfig.Instance
        Console.WriteLine(String.Format("DB Server   :{0}", db.Server))
        Console.WriteLine(String.Format("DB User     :{0}", db.User))
        Console.WriteLine(String.Format("DB Password :{0}", db.Password))

        Console.WriteLine()

        Console.WriteLine("Press any key to end.")
        Console.ReadKey()
    End Sub

    Private Sub OnEnvironmentRead(sender As Object, e As EnvironmentReadEventArgs)
        Dim isdebug As Boolean = False
#If DEBUG Then
        isdebug = True
#End If
        If isdebug = False AndAlso String.IsNullOrEmpty(e.Tag) = False Then
            e.EnvironmentName = e.Tag
        End If
    End Sub
End Module
